# 大量数据成员测试 - 集合远快于列表
import time

# 准备测试数据
large_list = list(range(1_000_000))
large_set = set(large_list)

# 测试列表查找时间
start_time = time.time()
result1 = 999999 in large_list
list_time = time.time() - start_time

# 测试集合查找时间
start_time = time.time()
result2 = 999999 in large_set
set_time = time.time() - start_time

print(f"列表查找时间: {list_time:.6f}秒")  # 列表查找时间: 0.005703秒
print(f"集合查找时间: {set_time:.6f}秒")  # 集合查找时间: 0.000005秒
print(f"集合比列表快 {list_time/set_time:.0f} 倍")  # 集合比列表快 1196 倍
